﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using LightManager.Effects;

namespace LightManager.UserControls
{
    internal partial class EffectControl : UserControl
    {
        public EffectControl()
        {
            InitializeComponent();
        }

        public Action DataSource
        {
            set
            {
                //this.lblEffect.Text = value.EffectString;
                //this.lblFrom.Text = value.From;
                this.lblTarget.Text = value.Target.Name;
                string effect = value.Effect.GetType().Name;
                if (value.Effect is DamageEffect)
                    if (((DamageEffect)value.Effect).Damages.Any(d => d.Soruce != DamageSources.Phisical))
                        effect += "_magic";
                this.pctImage.Image = this.imageList1.Images[effect];
                //this.lblDuration.Text = value.Duration.ToString();
                //this.pctTarget.Image = (value.Target.IsEnemy) ? this.evilImage : this.goodImage;
            }
        }

        private void pctImage_MouseEnter(object sender, EventArgs e)
        {
            this.OnMouseEnter(e);
        }

        private void pctImage_MouseLeave(object sender, EventArgs e)
        {
            this.OnMouseLeave(e);
        }

        private void pctImage_MouseClick(object sender, MouseEventArgs e)
        {
            this.OnClick(e);
        }
    }
}
